<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>智能导诊</title>
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" href="/lobsteruiframe/weui/css/weui.css" />
    <link rel="stylesheet" href="/lobsteruiframe/weui/css/weuix.css" />
    <script src="/lobsteruiframe/weui/js/zepto.min.js"></script>
    <script src="/lobsteruiframe/weui/js/zepto.weui.js"></script>
    <script src="/lobsteruiframe/weui/js/swipe.js"></script>
    <script src="/lobsteruiframe/weui/js/macy.js"></script>
    <script src="/jslib/lobster.js"></script>
    <script src="../js/template-web.js"></script>
</head>
<style>
    .res-bg {
        text-align: center;
        font-size: 16px;
    }

    .res-tit {
        padding: 12px;
        text-align: center;
        background-color: #4990e240;
        box-shadow: 0 1px 4px #4990e260 inset;
        font-size: 14px;
    }

    .res-desc {
        padding-top: 50px;
    }

    .res-dept {
        padding-bottom: 50px;
        padding-top: 25px;
        font-size: 25px;
    }

    .res-dept text {
        font-size: 16px;
    }

    .res-btn {
        text-align: center;
    }

    .res-btn button {
        margin-bottom: 25px;
    }

    .blue-button-long {
        margin: 25px;
        height: 40px;
        line-height: 40px;
        font-size: 15px;
        border-radius: 20px;
        text-align: center;

    }

    .white-color {
        color: #fff !important;

    }

    .blue-bd {
        background-color: #4990e2 !important;
        color: #fff !important;
    }

    .white-bd {
        background-color: #fff !important;

    }

    .blue-color {
        color: #4990e2 !important;

    }

    .textYellow {
        color: #FF9800 !important;

    }

    .blue-border {
        border: 1px #4990e2 solid;
        box-sizing: border-box;
    }
</style>

<body>
    <div class="res-bg">
        <div class="res-tit textYellow"> 推荐结果,仅供参考！</div>
        <div class="res-desc">根据您的描述我们给您推荐的科室</div>
        <div class="res-dept textYellow"></div>
        <div class="res-btn page-bd-15">
            <a href="javascript:;" class="weui-btn weui-btn_primary" id="toRegister">去挂号</a>
            <a href="javascript:;" class="weui-btn weui-btn_plain-primary" id="onBack">返回</a>
        </div>
    </div>
</body>
<script>
    var controller = {
        data: {
            symptom: {},
            relationlist: [],
        },
        //初始化页面
        initpage: function () {
            var self = this;
            var symid = lobsterh5.GetUrlParam("symid")
            var aidata = JSON.parse(localStorage.getItem("aidata"));
            var symlist = aidata.symptomList;
            var entity = symlist.filter(a => a.SymId == symid)[0];
            if (entity) {
                self.data.symptom = entity;
                // self.getdeptrelation(self.data.symptom.DeptCode).then(res => {
                //     if (res.length > 0) {
                //         self.data.relationlist = res;
                //         $(".textYellow").text(entity.Name);
                //     } else {
                //         $(".textYellow").text(entity.Name + "(暂未开通)");
                //     }
                // })
                $(".textYellow").text(entity.Name + "(暂未开通)");
            }
            self.initevent();
        },
        //初始化事件
        initevent: function () {
            var self = this;
            $("#toRegister").click(function () {
                if (self.data.relationlist.length > 0) {
                    var arr = self.data.relationlist.map(n => { return { DeptId: n.HisDeptId, BranchHospitalId: n.HisBranchId } });
                    localStorage.removeItem("aidata");
                    location.href = "/weuiapp/3223/register/doctorlist.html?deptarr=" + JSON.stringify(arr);
                } else {
                    $.toast("暂未开通", 'text');
                }
            });
            $("#onBack").click(function () {
                window.history.go(-1);
            })
        },
        //获取科室关联数据
        getdeptrelation: function (deptId) {
            var self = this;
            return new Promise((resolve, reject) => {
                lobsterh5.GET("/lowcode/APP20210729225526937/hospitalguide/?fun=symptom.getdeptrelation", { deptId: deptId }).then(res => {
                    resolve(res);
                }).catch(res => {
                    reject(res);
                });
            })
        },
    }
    $(function () {
        controller.initpage();
    })
</script>

</html>